{extend name='user/public/layout' /}
{block name='content'}
<div class="overflow_h">
    <div class="screen">
        <div class="screen_box01 overflow_h">
            <ul>
                <li><a href="{:url('user.rental/index')}" class="on">出租房列表</a></li>
                <li><a href="{:url('user.rental/add')}">添加出租房</a></li>
                <li><a href="{:url('user.rental/message')}">出租房留言</a></li>
            </ul>
        </div>
    </div>
    <div class="user-nav">
        <table class="tab_list">
            <tr>
                <th style="width: 20%">发布时间</th>
                <th style="width: 10%">所属区域</th>
                <th style="width: 40%">房源名称</th>
                <th style="width: 10%">浏览量</th>
                <th style="width: 10%">状态</th>
                <th style="width: 10%">操作</th>
            </tr>
            {volist name="lists" id='vo' empty='<tr><td>暂无数据</td></tr>'}
            <tr>
                <td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
                <td>{$vo.city_name}{$vo.area_name}</td>
                <td><a href="{:url('Chuzu/detail',['id'=>$vo['id']])}" target="_blank">{$vo.title}</a></td>
                <td>{$vo.hits}</td>
                <td class="status_{$vo['status']}">{:optionStatus($vo['status'])}</td>
                <td class="dn">{if condition='$vo.status neq 1'}<a href="{:url('user.rental/edit',['id'=>$vo['id']])}">编辑</a><span>|</span>{/if}<a class="J_del" href="javascript:;" data-uri="{:url('user.rental/delete',['id'=>$vo['id']])}">删除</a><td>
            </tr>
            {/volist}
        </table>
        <div class="plastic_bottom_pages">
            {$pages}
        </div>
    </div>
</div>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $(function(){
        $('.J_del').bind('click',function(){
            if(confirm('您确定要删除所选房源么？')){
                $.get($(this).data('uri'),function(res){
                    if(res.status == 1){
                        layer.msg(res.msg,{icon:1});
                        setTimeout(function(){window.location.reload();},2000);
                    }else{
                        layer.msg(res.msg,{icon:2});
                    }
                });
            }
        });
    });
</script>
{/block}